package com.lk.spring.boot.sample.config;

import org.apache.tomcat.jdbc.pool.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * datasource源配置 
* <p>Title:DataSourceConfig </p>
* <p>Description: </p>
* <p>Company: </p> 
* @author kexl
* @date 上午10:11:49
 */
@Configuration
public class DataSourceConfig {

	private final static String DRIVERCLASS="com.mysql.cj.jdbc.Driver";
	private final static String URL="jdbc:mysql://localhost:3306/test?serverTimezone=UTC&characterEncoding=utf8&useUnicode=true&useSSL=false";
	private final static String USERNAME="root";
	private final static String PASSWORD="123456";
	
	@Bean
	public DataSource dataSource(){
		DataSource dataSource=new DataSource();
		dataSource.setDriverClassName(DRIVERCLASS);
		dataSource.setUrl(URL);
		dataSource.setUsername(USERNAME);
		dataSource.setPassword(PASSWORD);
		return dataSource;
	}
	
}
